//package xyz.hubery.boot;
//
//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.CommandLineRunner;
//import org.springframework.stereotype.Component;
//import org.springframework.util.CollectionUtils;
//import xyz.hubery.disruptor.DisruptorTemplate;
//import xyz.hubery.domain.EntrustOrder;
//import xyz.hubery.mapper.EntrustOrderMapper;
//import xyz.hubery.model.Order;
//import xyz.hubery.util.BeanUtil;
//
//import java.util.Collections;
//import java.util.List;
//
//@Component
//public class DataLoaderCmdLine implements CommandLineRunner {
//
//    @Autowired
//    private EntrustOrderMapper entrustOrderMapper;
//    @Autowired
//    private DisruptorTemplate disruptorTemplate;
//
//    @Override
//    public void run(String... args) throws Exception {
//        // 读取数据
//        List<EntrustOrder> entrustOrders = entrustOrderMapper.selectList(new LambdaQueryWrapper<EntrustOrder>()
//                .eq(EntrustOrder::getStatus, 0)
//                .orderByAsc(EntrustOrder::getCreated)
//        );
//        if(!CollectionUtils.isEmpty(entrustOrders)) {
//            for (EntrustOrder entrustOrder : entrustOrders) {
//                Order order = BeanUtil.entrustOrderToOrder(entrustOrder);
//                disruptorTemplate.onData(order); // 将数据发送到RingBuffer队列
//            }
//        }
//    }
//
//
//}
